package com.atguigu.tingshu.payment.client;

import com.atguigu.tingshu.payment.service.WxPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/***
 * 供内部调用接口
 */


@RestController
@RequestMapping("/client/pay/payment")
public class WxPaymentClientController {

    @Autowired
    private WxPayService wxPayService;

    /**
     * 微信支付接口,申请支付二维码
     */
    @GetMapping("/getPayInfoFromWx")
    public String getPayInfoFromWx(@RequestParam Map<String,String> params){

        return wxPayService.getPayInfoFromWx(params);
    }


    /**
     * 查询支付订单的结果，主动查询，兜底
     * @param orderNo
     * @return
     */
    @GetMapping("/getOrderPayResult/{orderNo}")
    public String getOrderPayResult(@PathVariable(value = "orderNo") String orderNo){
        return wxPayService.getOrderPayResult(orderNo);
    }
}
